﻿@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache">
    <meta http-equiv="Expires" content="0">
    <title>后台登录</title>
    <link href="~/Content/Backstage/login.css" rel="stylesheet" />
    <link href="~/Content/layui/css/layui.css" rel="stylesheet" />
</head>

<body>
    <div class="login_box">
        <div class="login_l_img"><img src="~/Content/Backstage/images/login-img.png" /></div>
        <div class="login">
            <div class="login_logo"><a href="#"><img src="~/Content/Backstage/images/login_logo.png" /></a></div>
            <div class="login_name">
                <p>后台管理系统</p>
            </div>
            <input name="UserName" id="UserName" type="text" value="用户名" onfocus="this.value=''" onblur="if(this.value==''){this.value='用户名'}">
            <span id="password_text" onclick="this.style.display = 'none'; document.getElementById('UserPwd').style.display = 'block'; document.getElementById('UserPwd').focus();">密码</span>
            <input name="UserPwd" type="password" id="UserPwd" style="display:none;" onblur="if(this.value==''){document.getElementById('password_text').style.display='block';this.style.display='none'};" />
            <input value="登录" style="width:100%;" type="button" onclick="login()">
        </div>
        <div class="copyright">周黎博客后台 版权所有©2016-2018 技术支持电话：17783042962</div>
    </div>
    <script src="~/Scripts/jquery-3.3.1.min.js"></script>
    <script src="~/Content/layui/layui.js"></script>
    <script>
        layui.use('layer', function () {
            var layer = layui.layer;
        });
        /*表单验证*/
        function login() {
            var loginData = {
                UserName: $("#UserName").val(),
                UserPwd: $("#UserPwd").val()
            }
            if (loginData.UserName == '用户名') {
                layer.msg('请输入账号', { icon: 5, time: 500 });
                return;
            }
            if (loginData.UserPwd == '') {
                layer.msg('请输入密码', { icon: 5, time: 500 });
                return;
            }
            var index=layer.msg('', { shade: 0.3, time: 5000, type: 3 });
            $.post('/Admin/Login/login',
                loginData,
                function (data) {
                    layer.close(index);
                    console.log(data);
                    if (data.StateCode == 200) {
                        location.href = "/Admin/Home/Backstage_home";
                    }
                    else {
                        layer.msg(data.Messages, { icon: 5, time: 1000 });
                    }
                },'json');
        }
    </script>
</body>
</html>
